package com.example.cloud.model.business.reservation;

import com.alibaba.fastjson.annotation.JSONField;
import com.example.cloud.model.common.CommonModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * Created by wangtao on 2018/1/26.
 * 预约表
 */
@Entity(name = "business_reservation")
@EqualsAndHashCode(callSuper = true)
@Data
public class Reservation extends CommonModel{
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 预约对象
    @Column(name = "patient_id")
    private Long patientId;
    // 预约者姓名
    @Column(name = "patient_name")
    private String patientName;
    // 病历号
    @Column(name = "medical_number")
    private String medicalNumber;
    // 预约状态
    @Column(name = "status")
    private int status;
    // 医生完成状态
    @Column(name = "doctor_status", columnDefinition = "INT DEFAULT 0")
    private int doctorStatus;
    // 护士完成状态
    @Column(name = "nurse_status", columnDefinition = "INT DEFAULT 0")
    private int nurseStatus;
    // 客服完成状态
    @Column(name = "customer_status", columnDefinition = "INT DEFAULT 0")
    private int customerStatus;
    // 是否排班{0：否 1：是}
    @Column(name = "is_schedule", columnDefinition = "INT DEFAULT 0")
    private int isSchedule;
    /**
     * 预约类型
     * 1：会员/2：非会员
     */
    @Column(name = "type")
    private int type;
    /**
     * 记录类型
     * 0: 预约记录 1：支持记录
     */
    @Column(name = "record_type",columnDefinition = "INT DEFAULT 0")
    private int recordType;
    // 问题描述
    @Column(name = "description")
    private String description;
    // 可能诊断
    @Column(name = "diagnosis")
    private String diagnosis;
    // 承诺备注
    @Column(name = "promise")
    private String promise;
    // 提醒方式{1：短信 2：微信 3：电话}
    @Column(name = "remind")
    private int remind;
    // 处理方式 1:电话随访 2:预约到店
    @Column(name = "process")
    private int process;
    // 预约医生
    @NotNull(message = "预约医生不能为空")
    @Column(name = "doctor_id")
    private Long doctorId;
    // 医生姓名
    @Column(name = "doctor_name")
    private String doctorName;
    // 预约护士
    @NotNull(message = "预约护士不能为空")
    @Column(name = "nurse_id")
    private Long nurseId;
    // 护士姓名
    @Column(name = "nurse_name")
    private String nurseName;
    // 专家主键
    @Column(name = "expert_id")
    private Long expertId;
    // 专家名称
    @Column(name = "expert_name")
    private String expertName;
    // 预约时间
    @Column(name = "appointment")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date appointment;
    // 医生接诊的时间
    @Column(name = "diagnosis_time")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date diagnosisTime;
    // 预约完成的时间
    @Column(name = "complete_time")
    @JSONField(format = "yyyy-MM-dd HH:mm")
    private Date completeTime;
    // 改约次数
    @Column(name = "reinventions",columnDefinition = "INT default 0")
    private int reinventions;
    // 之前预约记录的主键
    @Column(name = "parent_id")
    private Long parentId;
    // 预约备注
    @Column(name = "note")
    private String note;
    // 系统来源{0：病案系统 1：小程序}
    @Column(name = "source", columnDefinition = "INT DEFAULT 0")
    private int source;
    // 账户编号
    @Column(name = "account_id")
    private Long accountId;
    // 用户编号
    @Column(name = "user_id")
    private Long userId;
    // 组织机构编号
    @Column(name = "organ_id")
    private Long organId;
    // 组织机构名称
    @Column(name = "organ_name")
    private String organName;
    // 预约时间
    @Transient
    private String appointmentStr;
    // 主管医生
    @Transient
    private String competentDoctor;
    // 主管护士
    @Transient
    private String competentNurse;
}
